package cn.com.guage.dtm.mapping.service.impl;

import java.util.List;
import cn.com.guage.dtm.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import cn.com.guage.dtm.mapping.mapper.MappingNumberRuleMapper;
import cn.com.guage.dtm.mapping.domain.MappingNumberRule;
import cn.com.guage.dtm.mapping.service.IMappingNumberRuleService;
import cn.com.guage.dtm.common.core.text.Convert;

/**
 * 编号规则Service业务层处理
 * 
 * @author liujun
 * @date 2021-07-14
 */
@Service
public class MappingNumberRuleServiceImpl implements IMappingNumberRuleService 
{
    @Autowired
    private MappingNumberRuleMapper mappingNumberRuleMapper;

    /**
     * 查询编号规则
     * 
     * @param noRuleId 编号规则ID
     * @return 编号规则
     */
    @Override
    public MappingNumberRule selectMappingNumberRuleById(Long noRuleId)
    {
        return mappingNumberRuleMapper.selectMappingNumberRuleById(noRuleId);
    }

    /**
     * 查询编号规则列表
     * 
     * @param mappingNumberRule 编号规则
     * @return 编号规则
     */
    @Override
    public List<MappingNumberRule> selectMappingNumberRuleList(MappingNumberRule mappingNumberRule)
    {
        return mappingNumberRuleMapper.selectMappingNumberRuleList(mappingNumberRule);
    }

    /**
     * 新增编号规则
     * 
     * @param mappingNumberRule 编号规则
     * @return 结果
     */
    @Override
    public int insertMappingNumberRule(MappingNumberRule mappingNumberRule)
    {
        mappingNumberRule.setCreateTime(DateUtils.getNowDate());
        return mappingNumberRuleMapper.insertMappingNumberRule(mappingNumberRule);
    }

    /**
     * 修改编号规则
     * 
     * @param mappingNumberRule 编号规则
     * @return 结果
     */
    @Override
    public int updateMappingNumberRule(MappingNumberRule mappingNumberRule)
    {
        mappingNumberRule.setUpdateTime(DateUtils.getNowDate());
        return mappingNumberRuleMapper.updateMappingNumberRule(mappingNumberRule);
    }

    /**
     * 删除编号规则对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteMappingNumberRuleByIds(String ids)
    {
        return mappingNumberRuleMapper.deleteMappingNumberRuleByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除编号规则信息
     * 
     * @param noRuleId 编号规则ID
     * @return 结果
     */
    @Override
    public int deleteMappingNumberRuleById(Long noRuleId)
    {
        return mappingNumberRuleMapper.deleteMappingNumberRuleById(noRuleId);
    }
}
